Support async refreshable credential callbacks in Python bindings#1639
Support async refreshable credential callbacks in Python bindings#1639mpiannucci wants to merge 17 commits intomainfrom
Conversation
paraseba
left a comment
There was a problem hiding this comment.
This is a miracle of engineering hehe, I understand little of it, but that's OK. I hope we can make Samantha's tests pass and merge.
| return asyncio.run(coroutine) | ||
| except RuntimeError as err: | ||
| coroutine.close() | ||
| if "asyncio.run() cannot be called from a running event loop" in str(err): |
There was a problem hiding this comment.
Interesting.... this is a bit of a breaking change, because everybody (including Earthmover) uses True for scatter
There was a problem hiding this comment.
I'll think on this..
- When no Python event loop is running, create a persistent fallback loop on a background thread instead of calling asyncio.run() each time (which creates a new temporary loop per invocation). - Detect potential deadlocks when the credential callback targets the same event loop that is currently blocked, and raise an error instead of hanging. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
This is working well now, but it required adding throwing an exception when calling synbc api from async context I think we need to change this to warn that this is can lead to deadlocks and that in a future version of icechunk this behavior may be disallowed. A good example of the consequence of this is the xarray test failure |
|
@dcherian i dont understand the xarray test suite, do you ahve any context on this? |
Adds support for async refreshable credential callbacks in the Python bindings, allowing users to provide async def functions for credential refresh that work correctly across sync and async contexts via pyo3-async-runtimes' TaskLocals bridge.
Closes #1424